﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 参数是引用类型的值传递和引用传递
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] a = { 1, 2, 3 };
            //AddOne(a);
            AddOne2(ref a);
            foreach (int k in a)
                Console.WriteLine(k);
        }
        static void AddOne(int[] a)
        {
            for(int i=0;i<a.Length;i++)
            {
                a[i]++;
            }
        }
        static void AddOne2(ref int[] a)
        {
            a = new int[4] { 11, 12, 13, 14 };
            for (int i = 0; i < a.Length; i++)
            {
                a[i]++;
            }
        }
    }
}
